from rest_framework import serializers
from .models import GoodsShelf


class GoodsSerializer(serializers.ModelSerializer):
    class Meta:
        model = GoodsShelf
        fields = ['id', 'goods_intro', 'goods_name', 'selling_price', 'sales_num', 'goods_img']


class GoodsDetailSerializer(serializers.ModelSerializer):
    class Meta:
        model = GoodsShelf
        fields = ['id', 'goods_name', 'goods_intro', 'goods_img', 'goods_detail', 'original_price',
                  'selling_price', 'sales_num', 'goods_banner', 'goods_ad', 'goods_arguments']

        extra_kwargs = {'goods_banner': {'read_only': True},
                        'goods_ad': {'read_only': True},
                        'goods_arguments': {'read_only': True}}








